<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><?php echo $article['title'];?></title>
    <meta name="keywords" content="<?php echo $article['title'];?>"/>
    <meta name="description" content="<?php echo sub_html($article['content'], 100);?>"/>
    <link rel="stylesheet" type="text/css" href="/assets/auicss/aui.css?v=1" />
    <link rel="stylesheet" href="/assets/css/normalize.css">
    <link rel="stylesheet" href="/assets/css/main.css">
    <link href="/assets/prism.css" rel="stylesheet" />
    <style>
        .c{width: 1200px; margin: 0 auto;}
        .c_left{width: 800px; float: left;}
        .c_right{width: 400px; float: right;}
        .footer{clear: both; width: 100%}
        .aui-list{border-top: 0;}
        .main-nav .active{color: #ff7400;}
        .aui-card-list-footer span{font-size: 14px;}
        .aui-card-list-content, .aui-card-list-content-padded{line-height: 30px;}
        .aui-card-list-content-padded{padding: 0 0.75rem;}
        .aui-card-list-header, .aui-card-list-footer{padding: 0 0.75rem; min-height: 2rem;}
        .aui-card-list a{display: block;}
        .aui-card-list a:hover,  a.aui-list-item:hover{background-color: #f0fafb; cursor: pointer;}
        a.aui-list-item{display: block; color: #212121}
        .aui-list .aui-ellipsis-2{display:-webkit-box; font-size: 14px;}
        .aui-card-list-footer .lj{background: none; display: block;}
        .aui-card-list-footer .lj:hover{background: none;}
        .qr_code{text-align: center;}
        .qr_code img{margin: 0 auto;}
        .tjck{width: 600px; margin: 10px auto; padding-bottom: 10px; height: auto; overflow: hidden;}
        .tjck input{border: 1px solid #9d9d9d;width: 165px;height: 34px;padding: 3px; display: inline-block; margin: 0 79px 0 122px; float: left;}
        .tjck .aui-label{padding: 10px; float: left;}
    </style>
</head>
<body>
<!-- header -->
<?php
include_once 'inc_nav.php';
?>
<div class="header-placeholder"></div>
<div class="c">
    <div class="c_left aui-margin-t-15 aui-margin-b-15">
        <section class="aui-content">
            <div class="aui-card-list">
                <div class="aui-card-list-header aui-margin-b-15">
                    <?php echo $article['title'];?>
                </div>
                <?php
                if ($article['content']) {
                    ?>
                    <div id="" class="aui-card-list-content-padded aui-border-b aui-margin-b-15">
                        <pre><code class="language-go line-numbers line-highlight inline-color"><?php echo $article['content'];?></code></pre>
                    </div>
                    <?php
                }
                ?>

                <?php
                if ($article['code']) {
                    ?>
                    <div id="view_code" class="aui-card-list-content-padded aui-border-b aui-margin-b-15">
                        <pre><code class="language-go line-numbers line-highlight inline-color"><?php echo $article['code'];?></code></pre>
                    </div>
                <?php
                }
                ?>

                <?php
                /*
                if (get_cookie('ck_code')) {
                    ?>
                    <div id="view_code" class="aui-card-list-content-padded aui-border-b aui-margin-b-15">
                        <pre><code class="language-go line-numbers line-highlight inline-color"><?php echo $article['code'];?></code></pre>
                    </div>
                    <?php
                } else {
                    ?>
                    <div id="view_code" style="height: 100px; overflow: hidden;" class="aui-card-list-content-padded aui-border-b aui-margin-b-15">
                        <pre><code class="language-go line-numbers line-highlight inline-color"><?php echo $article['code'];?></code></pre>
                    </div>
                    <div id="is_ck" class="aui-card-list-footer aui-text-center">
                        <div>
                            <div class="qr_code"><img src="/assets/qr_code.jpg"></div>
                            <div>关注公众号获取查看密码，一次关注永久查看</div>
                            <div class="tjck">
                                <input id="psd" type="text" name="psd" placeholder="请输入查看密码" />
                                <div class="aui-label aui-label-primary" onclick="view_code()">查看完整代码</div>
                            </div>
                        </div>
                    </div>
                    <?php
                }
                */
                ?>
<!--                <div id="is_ck" class="aui-card-list-footer aui-text-center">-->
<!--                    本站代码搜集于网络或用户分享，如有争议请联系删除-->
<!--                </div>-->
            </div>
        </section>

        <div class="aui-content">
            <ul class="aui-list aui-media-list">
                <li class="aui-list-header">相关精彩文章</li>
                <?php
                foreach ($xg as $v) {
                    ?>
                    <a target="_blank" href="<?php echo site_url('home/v/'.$v['id'])?>" title="<?php echo $v['title'];?>" class="aui-list-item aui-list-item-arrow">
                        <div class="aui-media-list-item-inner">
                            <div class="aui-list-item-inner">
                                <div class="aui-list-item-text">
                                    <div class="aui-list-item-title"><?php echo $v['title'];?></div>
                                    <div class="aui-list-item-right"><?php echo date('m-d', $v['ctime']);?></div>
                                </div>
                                <div class="aui-list-item-text aui-ellipsis-2">
                                    <?php echo sub_html($v['content'], 100);?>
                                </div>
                            </div>
                        </div>
                    </a>
                    <?php
                }
                ?>
            </ul>
        </div>

    </div>

    <div class="c_right">
        <?php include_once 'inc_right.php'; ?>
    </div>
</div>
<?php
view_include('home/inc_foot');
?>
<script src="/assets/prism.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('pre').addClass("line-numbers").css("white-space", "pre-wrap");
    });
    function view_code() {
        var psd = $('#psd').val();
        $.post(
            '<?php echo base_url('home/ck_code')?>',
            {psd: psd},
            function( data ) {
                if(data){
                    if(data.status == 1){
                        $('#view_code').height('auto');
                        $('#is_ck').hide();
                    }else {
                        alert(data.info);
                    }
                }
                toast.hide();
            },
            'json'
        );
    }
    document.onkeydown = function(event_e){
        if( window.event )
            event_e = window.event;
        var int_keycode = event_e.charCode||event_e.keyCode;
        if(int_keycode ==13){
            //回车事件
            view_code();
        }
    }
</script>
</body>
</html>